#include<iostream>
#include"DoubleLinkedList.h"

List<int>::iterator find(List<int> L, int x)
{
    List<int>::iterator iter = L.begin();
    while (iter != L.end() )
    {
    	if (*iter == x)
    	{
    		return iter;
    	}
    	iter++;
    }
    return L.end();
}
 
int main(int argc, char* argv[])
{
    List<int> li;
    for (int i = 0; i < 100; i++)
    {
        li.push_back(i);
    } 
   
    for ( List<int>::iterator iter = li.begin(); iter != li.end(); )
    {
        if (*iter % 3 == 0)
        {
            iter = li.erase(iter);
        }
        else
        {
            std::cout << *iter << std::endl;
            ++iter;
        }
    }
    
    List<int> L;
    for (int i = 1; i < 6; i++)
    {
    	L.push_back(i);
    }
    for ( List<int>::iterator iter = L.begin(); iter != L.end(); )
    {
        std::cout << *iter << std::endl;
        ++iter;
    }
    List<int>::iterator itr = find(L, 3);
    itr = L.erase(itr);
    
    return 0;    
}
